class TakeComment extends React.Component {
    content = React.createRef()
    async addWeibo() {
        const content = this.content.current.value.trim()
        // 判断表单内容
        if (content.length === 0) {
            alert('请输入内容')
            return
        }
        // 清空输入框
        this.content.current.value = null;
        // 发送添加微博请求
        const result = await this.$axios.post('http://localhost:8081/weibo', {
            content
        })
        this.props.getWeibo()
    }
    render() {
        return (
            <div className="takeComment">
                <textarea ref={this.content} name="textarea" className="takeTextField" id="tijiaoText"></textarea>
                <div className="takeSbmComment">
                    <input onClick={this.addWeibo.bind(this)} type="button" className="inputs" value="" />
                </div>
            </div>
        )
    }
}